package com.youoor.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;
import org.springframework.util.CollectionUtils;

import com.youoor.common.base.BaseDaoImpl;
import com.youoor.common.base.BaseMapper;
import com.youoor.dao.CardFavoDao;
import com.youoor.domain.CardFavo;
import com.youoor.domain.CardFavoQuery;
import com.youoor.persistence.CardFavoMapper;
@Repository("cardFavoDao")
public class CardFavoDaoImpl extends BaseDaoImpl<CardFavo,CardFavoQuery,Long> implements CardFavoDao {
	private static final Logger logger = LoggerFactory.getLogger(CardFavoDaoImpl.class);
	

	
	@Resource
	private CardFavoMapper cardFavoMapper;


	@Override
	public BaseMapper<CardFavo, CardFavoQuery, Long> getBaseMapper() {
		return cardFavoMapper;
	}


	@Override
	public CardFavo verifyFavo(int cardId, int favoCardId) {
		CardFavoQuery query = new CardFavoQuery();
		query.createCriteria().andCardIdEqualTo(cardId).andFavoCardIdEqualTo(favoCardId);
		List<CardFavo> list = cardFavoMapper.selectByExample(query, null);
		if(!CollectionUtils.isEmpty(list)) {
			return list.get(0);
		}
		return null;
	}


	@Override
	public void insertCardFavo(CardFavo cardFavo) {
		cardFavoMapper.insert(cardFavo);
		
	}







}
